package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JPasswordField;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.RoleOperationPanelBtn;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;



public class ChangePasswordJpanel extends JPanel {

    private JPasswordField Oldpassword,// 旧密码框
            Newpassword;// 新密码框
    private RoleOperationPanelBtn btnChangepwd;// 修改密码按钮

    public ChangePasswordJpanel() throws Exception {
    		// 键盘监听
            this.setPreferredSize(new Dimension(358, 329));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);

            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 21);
            offBtn.setBounds(358 - 37, 10, 25, 25);
            this.add(offBtn);

            Oldpassword = new JPasswordField();
            Oldpassword.setBounds(132, 62, 175, 16);
            Oldpassword.setForeground(Color.white);
            Oldpassword.setBackground(UIUtils.Color_BACK);
            Oldpassword.setCaretColor(Color.white);
            Oldpassword.setBorder(BorderFactory.createEmptyBorder());
            Oldpassword.setFont(new Font("微软雅黑", 1, 16));
            this.add(Oldpassword);

            Newpassword = new JPasswordField();
            Newpassword.setBounds(132, 96, 175, 16);
            Newpassword.setForeground(Color.white);
            Newpassword.setBackground(UIUtils.Color_BACK);
            Newpassword.setCaretColor(Color.white);
            Newpassword.setBorder(BorderFactory.createEmptyBorder());
            Newpassword.setFont(new Font("微软雅黑", 1, 16));
            this.add(Newpassword);

            btnChangepwd = new RoleOperationPanelBtn("skin/8100226/newbutton/B22.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16,
                    "修改密码");
            btnChangepwd.setBounds(143, 266, 99, 24);
            this.add(btnChangepwd);
    }

    private ImageIcon icon;

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        // 炼化
        if (icon == null) {
        icon = new ImageIcon("inkImg/newbackground/B258.png");
        }

        g.drawImage(icon.getImage(), 0, 0, 358, 329, this);

    }

    public JPasswordField getOldpassword() {
        return Oldpassword;
    }

    public void setOldpassword(JPasswordField oldpassword) {
        Oldpassword = oldpassword;
    }

    public JPasswordField getNewpassword() {
        return Newpassword;
    }

    public void setNewpassword(JPasswordField newpassword) {
        Newpassword = newpassword;
    }

    public RoleOperationPanelBtn getBtnChangepwd() {
        return btnChangepwd;
    }

    public void setBtnChangepwd(RoleOperationPanelBtn btnChangepwd) {
        this.btnChangepwd = btnChangepwd;
    }
}
